🤖 fix: accept description as alias for display_name in bash tool#3247
Merged
🤖 fix: accept description as alias for display_name in bash tool#3247
Conversation
DeepSeek V4 emits 'description' instead of 'display_name' for the bash tool. Normalize the alias in the schema preprocess so the call still validates without exposing the alias in the public tool description.
Collaborator
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
mux-bot Bot
added a commit
that referenced
this pull request
May 7, 2026
The bash tool's z.preprocess shim normalizes quirky model emissions to canonical field names. After the DeepSeek v4 fix in #3247 added a second 'description' → 'display_name' rename block (mirroring the existing 'command' → 'script' rename), the two blocks were structurally identical: skip when canonical is already a string, drop the alias via destructure, re-spread with the canonical name. Each alias still required its own 'as Record<string, unknown> & { <alias>: string }' cast plus the same three-line destructure/spread. Extract a private renameAliasField(obj, alias, canonical) helper that captures the rename pattern in one place, with the rationale for why aliases exist (and why they stay undocumented) noted on the helper. The call site collapses to two named lines that read as the intent ('rename command to script', 'rename description to display_name') instead of fifteen lines of mostly-identical destructure/spread. Pure refactor — emitted JS, the canonical-field-wins precedence, the 'no-op when neither alias nor canonical is a string' branches, and the existing 36-test toolDefinitions suite (including the four new command/description alias precedence cases) are all unchanged.
mux-bot Bot
added a commit
that referenced
this pull request
May 7, 2026
The bash tool's z.preprocess shim normalizes quirky model emissions to canonical field names. After the DeepSeek v4 fix in #3247 added a second 'description' → 'display_name' rename block (mirroring the existing 'command' → 'script' rename), the two blocks were structurally identical: skip when canonical is already a string, drop the alias via destructure, re-spread with the canonical name. Each alias still required its own 'as Record<string, unknown> & { <alias>: string }' cast plus the same three-line destructure/spread. Extract a private renameAliasField(obj, alias, canonical) helper that captures the rename pattern in one place, with the rationale for why aliases exist (and why they stay undocumented) noted on the helper. The call site collapses to two named lines that read as the intent ('rename command to script', 'rename description to display_name') instead of fifteen lines of mostly-identical destructure/spread. Pure refactor — emitted JS, the canonical-field-wins precedence, the 'no-op when neither alias nor canonical is a string' branches, and the existing 36-test toolDefinitions suite (including the four new command/description alias precedence cases) are all unchanged.
mux-bot Bot
added a commit
that referenced
this pull request
May 9, 2026
The bash tool's z.preprocess shim normalizes quirky model emissions to canonical field names. After the DeepSeek v4 fix in #3247 added a second 'description' → 'display_name' rename block (mirroring the existing 'command' → 'script' rename), the two blocks were structurally identical: skip when canonical is already a string, drop the alias via destructure, re-spread with the canonical name. Each alias still required its own 'as Record<string, unknown> & { <alias>: string }' cast plus the same three-line destructure/spread. Extract a private renameAliasField(obj, alias, canonical) helper that captures the rename pattern in one place, with the rationale for why aliases exist (and why they stay undocumented) noted on the helper. The call site collapses to two named lines that read as the intent ('rename command to script', 'rename description to display_name') instead of fifteen lines of mostly-identical destructure/spread. Pure refactor — emitted JS, the canonical-field-wins precedence, the 'no-op when neither alias nor canonical is a string' branches, and the existing 36-test toolDefinitions suite (including the four new command/description alias precedence cases) are all unchanged.
mux-bot Bot
added a commit
that referenced
this pull request
May 10, 2026
The bash tool's z.preprocess shim normalizes quirky model emissions to canonical field names. After the DeepSeek v4 fix in #3247 added a second 'description' → 'display_name' rename block (mirroring the existing 'command' → 'script' rename), the two blocks were structurally identical: skip when canonical is already a string, drop the alias via destructure, re-spread with the canonical name. Each alias still required its own 'as Record<string, unknown> & { <alias>: string }' cast plus the same three-line destructure/spread. Extract a private renameAliasField(obj, alias, canonical) helper that captures the rename pattern in one place, with the rationale for why aliases exist (and why they stay undocumented) noted on the helper. The call site collapses to two named lines that read as the intent ('rename command to script', 'rename description to display_name') instead of fifteen lines of mostly-identical destructure/spread. Pure refactor — emitted JS, the canonical-field-wins precedence, the 'no-op when neither alias nor canonical is a string' branches, and the existing 36-test toolDefinitions suite (including the four new command/description alias precedence cases) are all unchanged.
mux-bot Bot
added a commit
that referenced
this pull request
May 10, 2026
The bash tool's z.preprocess shim normalizes quirky model emissions to canonical field names. After the DeepSeek v4 fix in #3247 added a second 'description' → 'display_name' rename block (mirroring the existing 'command' → 'script' rename), the two blocks were structurally identical: skip when canonical is already a string, drop the alias via destructure, re-spread with the canonical name. Each alias still required its own 'as Record<string, unknown> & { <alias>: string }' cast plus the same three-line destructure/spread. Extract a private renameAliasField(obj, alias, canonical) helper that captures the rename pattern in one place, with the rationale for why aliases exist (and why they stay undocumented) noted on the helper. The call site collapses to two named lines that read as the intent ('rename command to script', 'rename description to display_name') instead of fifteen lines of mostly-identical destructure/spread. Pure refactor — emitted JS, the canonical-field-wins precedence, the 'no-op when neither alias nor canonical is a string' branches, and the existing 36-test toolDefinitions suite (including the four new command/description alias precedence cases) are all unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DeepSeek V4 emits
descriptioninstead ofdisplay_namefor the bash tool, causing every bash invocation to fail validation. Normalizedescriptionas an undocumented alias fordisplay_namein the schema preprocess so calls validate without changing the public tool surface.Background
The
bashtool requiresdisplay_namefor every invocation. DeepSeek V4 reliably emitsdescriptioninstead, so we add an alias mirroring the existingcommand→scriptnormalization. The alias is intentionally undocumented in the tool description: we don't want to invite other models to use the wrong field.Implementation
Refactored the bash schema's
preprocessfrom a singleif/else if/elsechain into chained mutations on a localobjreference, so multiple normalizations can compose:command→script(existing).description→display_name(new, with a comment noting DeepSeek V4 as the reason).Canonical fields always win when both are provided, mirroring the existing
command/scriptprecedence.Validation
toolDefinitions.test.tscover the alias and the precedence behavior.bun test src/common/utils/tools/toolDefinitions.test.ts: 36 pass.make static-check: passed locally.Generated with
mux• Model:anthropic:claude-opus-4-7• Thinking:max• Cost:$0.62